package com.test;

import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;
import java.util.ArrayList;

import com.drdg.ibatis.model.User;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class UserManager {

	public static void main(String[] args) {
		try {
			
			Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
			SqlMapClient client = SqlMapClientBuilder.buildSqlMapClient(reader);
			ArrayList<User> uList = (ArrayList<User>) client.queryForList("selectAllUser");
			
			for (User u:uList) {
				System.out.print(u.getUname());
				System.out.println(u.getUpwd());
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
	}

}